import http from '@/api/index'

/* 分页查询 */
export function selectByPage (params) {
  return http.get('/asset/list', {params})
}
/* 按 id 查询 */
export function selectById (id) {
  return http.get('/asset/' + id)
}
/* 新增 */
export function insert (data) {
  return http.post('/asset', data)
}
/* 修改 */
export function update (data) {
  return http.put('/asset', data)
}
/* 删除 */
export function remove (id) {
  return http.delete('/asset/' + id)
}
/** 资产领用/归还 - 资产维护/维修状态置为闲置 */
export function changeStatus (id, params) {
  let path = '/asset/' + id
  path += '?to=' + params.to
  if (params.day) {
    path += '&day=' + params.day
  }
  return http.put(path)
}
export function selectReserve (depaId, status) {
  const path = '/asset/list/all?depaId=' + depaId + '&status=' + status
  return http.get(path)
}
/** 查询用户预定资产 */
export function selectByUser (userId) {
  return http.get('/asset/user/' + userId)
}
